const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    order_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "订单id",
      field: "order_id"
    },
    order_detail_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "订单详情id",
      field: "order_detail_id"
    },
    goods_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "商品详情id",
      field: "goods_id"
    },
    user_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "用户id",
      field: "user_id"
    },
    status: {
      type: DataTypes.INTEGER(3).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "状态（0待发放, 1已发放, 2已关闭）",
      field: "status"
    },
    rate: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "赠送比例",
      field: "rate"
    },
    integral: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "积分",
      field: "integral"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "添加时间",
      field: "add_time"
    },
    upd_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "更新时间",
      field: "upd_time"
    }
  };
  const options = {
    tableName: "sxo_goods_give_integral_log",
    comment: "",
    indexes: [{
      name: "order_id",
      unique: false,
      type: "BTREE",
      fields: ["order_id"]
    }, {
      name: "order_detail_id",
      unique: false,
      type: "BTREE",
      fields: ["order_detail_id"]
    }, {
      name: "goods_id",
      unique: false,
      type: "BTREE",
      fields: ["goods_id"]
    }, {
      name: "user_id",
      unique: false,
      type: "BTREE",
      fields: ["user_id"]
    }, {
      name: "status",
      unique: false,
      type: "BTREE",
      fields: ["status"]
    }, {
      name: "rate",
      unique: false,
      type: "BTREE",
      fields: ["rate"]
    }, {
      name: "integral",
      unique: false,
      type: "BTREE",
      fields: ["integral"]
    }]
  };
  const SxoGoodsGiveIntegralLogModel = sequelize.define("sxo_goods_give_integral_log_model", attributes, options);
  return SxoGoodsGiveIntegralLogModel;
};